<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>重庆企业医院协会 会员中心</title>
    <include file="public@head_base"/>
    <style>
        .status-div {
            padding: 10px;
            width: 320px;
            margin: auto;
            text-align: center;
            margin-top: 120px;
        }

        .status-div img {
            width: 180px;
        }

        .status-div p {
            margin-top: 24px;
            font-size: 16px;
            color: #0055aa;
            text-align: center;
        }
    </style>
</head>
<body class="layui-layout-body">
<form class="layui-form" style="width: 90%;margin: auto;background: #ffffff;padding-top: 24px;padding-bottom: 24px;"
      action="">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容</label>
        <div class="layui-input-block">
            <script type="text/plain" id="content" name="content"></script>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">附件</label>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn" id="file">
                    <i class="layui-icon">&#xe67c;</i>上传附件
                </button>
            </div>
        </div>
        <div class="layui-inline">
            <input type="hidden" name="file" id="input-file" value="">
            <p id="filename"></p>
        </div>

    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" value="{$mid}" name="mid">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<include file="public@scripts"/>
<script>
    //JavaScript代码区域
    layui.use(['element', 'table', 'form', 'upload'], function () {
        var element = layui.element;
        var table = layui.table;
        var upload = layui.upload;
        var form = layui.form;
        var uploadInst = upload.render({
            elem: '#file' //绑定元素
            , url: "{:cmf_url('user/tougao/upload')}" //上传接口
            , done: function (res) {
                //上传完毕回调
                if (res.code == 1) {
                    $("#filename").html(res.name);
                    $("#input-file").val(res.data.file);
                } else {

                }
            }
            , error: function () {
                //请求异常回调
            }
        });
        form.on('submit(formDemo)', function (data) {
            $.post("{:url('user/tougao/addPost')}", data.field, function (res) {
                if (res.code == 1) {
                    layer.alert(res.msg, function (index) {
                        window.parent.layer.closeAll();
                    })
                } else {
                    layer.msg(res.msg)
                }
            })
            return false;
        });

    });
    var editorcontent = new baidu.editor.ui.Editor();
    editorcontent.render('content');
    try {
        editorcontent.sync();
    } catch (err) {
    }
</script>
</html>